<?php namespace app\common\model;
use think\Loader;
use think\Validate;
use think\Db;

//用户表模型
class Users extends Base{
	  protected $insert = ['register_time',];  
	  protected function setRegisterTimeAttr()
		{
		    return time();
		}
	//添加管理员数据
	public function addData($data){
			$list=db('users')->select();
			halt($list);
		$validate = Loader::validate('Users');
		if(!$validate->check($data)){
		    return ['valid'=>0,'msg'=>$validate->getError()];
		}else{
			$data['password']=md5($data['password']);
			unset($data['comfirmpassword']);
//			var_dump($data);
		
			Db::name('users')->insert($data);
//			$user->allowField(true)->save();
			 return ['valid'=>1,'msg'=>'管理员添加成功！'];
		}
		
	}
}


